<%--
  Created by IntelliJ IDEA.
  User: koizumisinya
  Date: 2017/12/04
  Time: 19:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%--java代码的片段--%>
<%
    //获取项目名称
    String path = request.getContextPath();
    //获取完整的地址 http://localhost:8080/Demo1/
    String basePath = request.getScheme() + "://" + request.getServerName() + path + "/";
%>
<%--java变量 <%= %>    --%>

<%--java类 <%! %> --%>

<html>
<head>
    <title>This is a jsp</title>

    <%--输出一个java变量--%>
    <base href="<%= basePath %>">
</head>
<body>
<h3>JSP Page</h3>
<% int a = 10; %>
<% out.print(a++); %>
<%=a%>

<%!
    <%--相当于声明在类中的全局变量--%>
int a = 100;
%>

<% out.print(a++); %>
<% out.print(this.a++); %>
</body>
</html>
